package com.tech.koufu.ui;

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity;
import com.tech.koufu.R; 
import com.tech.koufu.ui.view.MenuLeftFragment; 
import android.os.Bundle;
import android.support.v4.app.Fragment; 
import android.support.v4.app.FragmentTransaction;
/**
 * slidemenu 主容器
 * @author jl_luo
 *
 */
public class BaseSlideMenuActivity extends SlidingFragmentActivity { 
	public SlidingMenu sm ;
	protected MenuLeftFragment leftMenuFragment;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		sm = getSlidingMenu(); 
		sm.setMode(SlidingMenu.LEFT);
		sm.setShadowWidthRes(R.dimen.shadow_width);
		sm.setShadowDrawable(R.drawable.shadow);
//		sm.setBehindOffsetRes(R.dimen.slidingmenu_offset); 
		sm.setBehindWidthRes(R.dimen.left_menu_width);
		sm.setFadeDegree(0.35f);
		sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
		
		setBehindContentView(R.layout.menu_frame);
		
		if (savedInstanceState == null) {
			FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
			leftMenuFragment = new MenuLeftFragment();
			t.replace(R.id.menu_frame, leftMenuFragment);
			t.commit();
		} else {
			leftMenuFragment = (MenuLeftFragment)this.getSupportFragmentManager().findFragmentById(R.id.menu_frame);
		} 
	}

 
}
